<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var a = 'a' + 1 + 1;
        document.write(a);
        var a = 1 + 1 + 'a' + 1 + 1;
        var b = 1 + 1 + 'a' + (1 + 1);
        console.log(a);
        console.log(b);
    </script>
    <script>
        var num = 0 / 0;
        console.log(num); //NaN, not a number,却是数字类型
        var n = 1 / 0;
        console.log(n); //Infinity ,无穷的, 也是数字类型
        var m = -1 / 0;  
        console.log(m); //-Infinity ,负无穷的
        // 无穷加无穷还是无穷
        // 无穷减无穷为NaN
    </script>

    <script>
        var c = 10;
        c = c + 1;
        console.log(c);
        c ++;
        console.log(c);
        c --;
        console.log(c);
        console.log(c ++);
        console.log(c);
        console.log(++c);
    </script>

    <script>
        // 赋值的顺序  自右向左， 计算的顺序，自左向右
        
        var aa = 10;
        var bb = ++aa - 1 + aa++; 
        // var bb = aa++ - 1 + aa++; //先计算aa++ - 1 然后aa自加1
        console.log(bb + " " + aa);

        var a1 = b1 = 1; //自右向左

        a1 = a1 + 10;
        a1 += 10;
        console.log(a1);
        a1 /= 10 + 1; //先算右边的
        // a1 = a1 + 10 + 1;
        console.log(a1);

        var a2 = 3;
        a2 %= 4;
        console.log(a2)
    </script>


    <script>
    // 调换两个变量的值，也可以使用中间变量
        var cc = 123;
        var dd = 234;
        cc = cc + dd;
        dd = cc - dd;
        cc = cc - dd;
    </script>
</body>
</html>